Use case: Initializing memory with a delay block to adjust timing

Initializing memory with a delay block to adjust timing.

Sequence diagram

Initializing memory with a delay block to adjust timing

  @startuml

    == Initialization ==
    "Application" -> "OSPI" : HAL_OSPI_Init()
    "OSPI" --> "Application" : HAL_OK or HAL_INVALID_PARAM
    "Application" -> "System" : OSPI HW Initialization
    note right: Initialize GPIO
    "System" --> "Application" :

    == Configuration ==

    "Application" -> "OSPI" : HAL_OSPI_DLYB_SetConfig()
    note right: Set delay block configuration
    "OSPI" --> "Application" : HAL_OK or HAL_ERROR or HAL_INVALID_PARAM

    == Process polling mode ==

    note over OSPI, Application: **Continue the process operations according to the targeted scenario**

  @enduml

Code snippet

HAL1

HAL2

/* Init and config sequence */
HAL_OSPI_Init(&ospi);





HAL_OSPI_DLYB_SetConfig(&ospi, 2);
/* */
hal_xspi_config_t HAL_XSPI_Global_Cfg_Struct;

HAL_XSPI_Init(&xspi, HAL_OCTOSPI);

HAL_XSPI_SetConfig(&xspi, &HAL_XSPI_Global_Cfg_Struct);

HAL_XSPI_DLYB_SetConfigDelay(&xspi, 2);
HAL_XSPI_DLYB_Enable(&xspi);

Key changes

  1. In HAL2, OSPI APIs are replaced by XSPI APIs (for example, HAL_OSPI_Init() becomes HAL_XSPI_Init()).

  2. In HAL2, delay block configuration uses HAL_XSPI_DLYB_SetConfigDelay() and can be enabled using HAL_XSPI_DLYB_Enable().